import { defineComponent, onUnmounted, reactive } from 'vue'
import Draw from './educationDraw'

export default defineComponent({
  components: {
    Draw,
  },
  setup() {
    let intervalInstance = null
    const cdata = reactive({
      xData:['2022-01', '2022-02', '2022-03', '2022-04', '2022-05', '2022-06', '2022-07'],
      value:[50, 100, 150, 200, 150, 100, 50],
      index :0
    })
    intervalInstance = setInterval(() => {
      cdata.index += 1
    }, 2000)

    onUnmounted(() => {
      clearInterval(intervalInstance)
    })
    return () => {
      return (
        <div>
          <Draw cdata={cdata} />
        </div>
      )
    }
  },
})
